home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / amos / eaissu3b.lha / Source_Code / AM_BangerGame.AMOS / AM_BangerGame.amosSourceCode next >
AMOS Source Code  |  1995-12-30  |  12KB  |  356 lines

  1. ' Game by Asa Margetts 
  2. ' ~~~~~~~~~~~~~~~~~~~~ 
  3. ' Firstrate Effex 1995 
  4. ' ~~~~~~~~~~~~~~~~~~~~ 
  5. '
  6. ' If you wish, you can improve/change this game as long as my name 
  7. ' is left on it. It is only a small part of what I've done on it so far. 
  8. ' It seems quite slow, so compile it for more speed. 
  9. '
  10. ' No sound has been added yet. All GFX files are in banks. 
  11. '  
  12. ' The game itself I started on Sunday, and have given up today (Tuesday) 
  13. ' so have been going just three days.
  14.  
  15. Hide On : Screen Open 0,320,256,4,Lowres
  16. Curs Off : Flash Off : Paper 0 : Cls 
  17.  
  18. Unpack 7 To 0 : Screen Open 2,320,256,16,Lowres
  19. Curs Off : Flash Off : Paper 0 : Cls : Screen Copy 0,0,0,320,256 To 2,0,0
  20. Palette 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  21. Fade 3 To 0 : Wait 45 : Screen Close 2 : Unpack 9 To 1 : Screen Hide 1
  22. Wait 100 : Screen Show 1 : Screen Close 0 : Wait 100 : Fade 2 : Wait 30 : Screen Close 1
  23.  
  24. ' Variables
  25. SAGA1=0 : GUN=0 : BULLETS=0 : X=50 : Y=197 : B=1 : SX=10 : SY=0
  26. Global X,Y,B,GUN,BULLETS,SX,SY,SAGA1
  27.  
  28. BEGIN:
  29. Screen Open 0,320,256,16,Lowres
  30. Curs Off : Flash Off : Paper 0 : Cls 
  31. Unpack 30 To 0 : Palette $202 : Screen Hide 0
  32. Screen Open 1,640,60,8,Lowres
  33. Curs Off : Flash Off : Paper 0 : Cls : Screen Hide 1
  34. Unpack 16 To 2 : Screen Hide 2
  35. Screen Copy 2,0,0,320,60 To 1,0,0
  36. Screen Copy 2,0,0,320,60 To 1,320,0
  37. Screen 1 : Get Palette 2 : Screen Close 2
  38. Screen Display 1,150,42,280,320 : Screen 0
  39. Channel 1 To Screen Offset 1
  40. Amal 1,"L: Let X=0 ; M 320,0,2000 ; J L" : Amal On 
  41. Screen 1 : Palette $202,,,,,$202 : Screen 0
  42.  
  43. Double Buffer : Screen Offset 0,10,0 : Screen Show 0 : Screen Show 1 : Bob 1,X,Y,B
  44. _BOBS
  45. Channel 10 To Bob 15
  46. Amal 10,"L: Let A=50 ; M 0,-30,30 ; Let A=51 ; M 0,30,30 ; J L"
  47. Channel 11 To Bob 20
  48. Amal 11,"L: A 0,(41,4)(42,4)(43,4)(45,4)(44,4)(43,4)(42,4) ; For R0=1 To 10 ; M -100,-20,150 ; M -100,20,150 ; Next R0 ; Let X=1000 ; J L"
  49. Channel 12 To Bob 21
  50. Amal 12,"L: A 0,(41,4)(42,4)(43,4)(45,4)(44,4)(43,4)(42,4) ; For R0=1 To 10 ; M -100,80,60 ; M -100,-80,60 ; Next R0 ; Let X=1000 ; J L"
  51. For I=10 To 12 : Amal On I : Next I
  52.  
  53. Wait Vbl : Bob Update Off : Timer=0
  54. Reserve Zone 3
  55. Set Zone 1,294,165 To 319,166
  56. Set Zone 2,555,165 To 616,166
  57. Set Zone 3,769,165 To 792,166
  58.  
  59. Do 
  60. Bob 1,X,Y,B
  61.  
  62. UPPERS
  63. FALL
  64.  
  65. Gosub HOLES
  66. Gosub _COLLISIONS
  67.  
  68. If Jright(1) Then Timer=0 : RIGHT
  69. If Jleft(1) Then Timer=0 : LEFT
  70. If Jdown(1) Then Timer=0 : _DOWN
  71. If Fire(1) and GUN=1 Then Timer=0 : BANG
  72. If Jup(1) Then Timer=0 : UP
  73.  
  74. If Key State(69)=True Then Goto GAMEOVER
  75.  
  76. LIMITATIONS
  77. GUNCHECK
  78.  
  79. If Timer=>200
  80. Bob Clear 
  81.       Repeat 
  82.          Bob Clear : Bob 1,X-2,Y+2,15 : Bob Draw : Screen Swap : Wait 8
  83.          Bob Clear : Bob 1,X-2,Y+2,16 : Bob Draw : Screen Swap : Wait 8
  84.          Bob Clear : Bob 1,X-2,Y+2,17 : Bob Draw : Screen Swap : Wait 8
  85.          Bob Clear : Bob 1,X-2,Y+2,18 : Bob Draw : Screen Swap : Wait 8
  86.       Until Joy(1)
  87.    Bob Clear : Timer=0 : B=1 : Bob 1,X,Y,B : Bob Draw : Screen Swap : Wait 5
  88. End If 
  89.  
  90. Bob Clear : Bob Draw : Screen Swap : Wait Vbl 
  91. Loop 
  92.  
  93.  
  94. ' Procedures 
  95. Procedure RIGHT
  96. Bob Clear 
  97. B=1 : X=X+1 : Bob 1,X,Y,B : _SCROLLRIGHT : Bob Draw : Screen Swap : Wait Vbl : Bob Clear 
  98. B=2 : X=X+1 : Bob 1,X,Y,B : _SCROLLRIGHT : Bob Draw : Screen Swap : Wait Vbl : Bob Clear 
  99. B=3 : X=X+1 : Bob 1,X,Y,B : _SCROLLRIGHT : Bob Draw : Screen Swap : Wait Vbl : Bob Clear 
  100. B=2 : X=X+1 : Bob 1,X,Y,B : _SCROLLRIGHT : Bob Draw : Screen Swap : Wait Vbl : Bob Clear 
  101. B=1 : X=X+1 : Bob 1,X,Y,B : _SCROLLRIGHT : Bob Draw : Screen Swap : Wait Vbl : Bob Clear 
  102. Bob Draw : Screen Swap : Wait Vbl 
  103. End Proc
  104. Procedure LEFT
  105. Bob Clear 
  106. B=4 : X=X-1 : Bob 1,X,Y,B : _SCROLLLEFT : Bob Draw : Screen Swap : Wait Vbl : Bob Clear 
  107. B=5 : X=X-1 : Bob 1,X,Y,B : _SCROLLLEFT : Bob Draw : Screen Swap : Wait Vbl : Bob Clear 
  108. B=6 : X=X-1 : Bob 1,X,Y,B : _SCROLLLEFT : Bob Draw : Screen Swap : Wait Vbl : Bob Clear 
  109. B=5 : X=X-1 : Bob 1,X,Y,B : _SCROLLLEFT : Bob Draw : Screen Swap : Wait Vbl : Bob Clear 
  110. B=4 : X=X-1 : Bob 1,X,Y,B : _SCROLLLEFT : Bob Draw : Screen Swap : Wait Vbl : Bob Clear 
  111. Bob Draw : Screen Swap : Wait Vbl 
  112. End Proc
  113. Procedure _DOWN
  114. Bob Clear 
  115. If Not Y=197
  116.    For I=Y To 197 Step 4
  117.    Bob Clear : Bob 1,X,I,B : Bob Draw : Screen Swap : Wait Vbl : Next I : Bob Clear 
  118.    Y=197
  119. End If 
  120.  
  121. If B=1
  122.    Bob 1,X+2,Y+2,7 : Bob Draw : Screen Swap : Wait 1 : Bob Clear 
  123.    Bob 1,X+2,Y+2,8 : Bob Draw : Screen Swap : Wait 1 : Bob Clear 
  124.    Bob 1,X,Y+2,9 : Bob Draw : Screen Swap : Wait 1 : Bob Clear 
  125.    Bob 1,X,Y+2,10 : Bob Draw : Screen Swap : Wait 8 : Bob Clear 
  126.    Repeat : Bob Clear : Bob Draw : Screen Swap : Wait Vbl : Until Joy(1) : Bob Clear 
  127.    Bob 1,X,Y+2,9 : Bob Draw : Screen Swap : Wait 1 : Bob Clear 
  128.    Bob 1,X+2,Y+2,8 : Bob Draw : Screen Swap : Wait 1 : Bob Clear 
  129.    Bob 1,X+2,Y+2,7 : Bob Draw : Screen Swap : Wait 1 : Bob Clear 
  130.    Bob 1,X,Y,B : Bob Draw : Screen Swap : Wait 8 : Bob Clear 
  131. End If 
  132.    If B=4
  133.       Bob 1,X,Y+2,11 : Bob Draw : Screen Swap : Wait 1 : Bob Clear 
  134.       Bob 1,X-1,Y+2,12 : Bob Draw : Screen Swap : Wait 1 : Bob Clear 
  135.       Bob 1,X-1,Y+2,13 : Bob Draw : Screen Swap : Wait 1 : Bob Clear 
  136.       Bob 1,X-1,Y+2,14 : Bob Draw : Screen Swap : Wait 8 : Bob Clear 
  137.       Repeat : Bob Clear : Bob Draw : Screen Swap : Wait Vbl : Until Joy(1) : Bob Clear 
  138.       Bob 1,X-1,Y+2,13 : Bob Draw : Screen Swap : Wait 1 : Bob Clear 
  139.       Bob 1,X-1,Y+2,12 : Bob Draw : Screen Swap : Wait 1 : Bob Clear 
  140.       Bob 1,X,Y+2,11 : Bob Draw : Screen Swap : Wait 1 : Bob Clear 
  141.       Bob 1,X,Y,B : Bob Draw : Screen Swap : Wait 8 : Bob Clear 
  142.    End If 
  143. Bob Draw : Screen Swap : Wait Vbl : Timer=0
  144. End Proc
  145. Procedure UP
  146. If Bob Col(1,4 To 6) Then Goto MARK
  147. If Zone(X,Y)=1 or Zone(X,Y)=2 or Zone(X,Y)=3 Then Goto MARK
  148. If Not Y=197 or Y=198 Then Goto _END
  149.  
  150. MARK:
  151. If B=1
  152.    B=3 : Bob Clear : Bob 1,X,Y,B : Bob Draw : Screen Swap : Wait Vbl 
  153.    D=0 : Repeat 
  154.             D=D+1 : Y=Y-1 : Bob Clear : Bob 1,X,Y,B : Bob Draw : Screen Swap : Wait Vbl 
  155.          Until D=35 : D=0 : B=1 : Bob Clear : Bob 1,X,Y,B : Bob Draw : Screen Swap : Wait Vbl : Bob Clear 
  156. End If 
  157. If B=4
  158.    B=6 : Bob Clear : Bob 1,X,Y,B : Bob Draw : Screen Swap : Wait Vbl 
  159.    D=0 : Repeat 
  160.             D=D+1 : Y=Y-1 : Bob Clear : Bob 1,X,Y,B : Bob Draw : Screen Swap : Wait Vbl 
  161.          Until D=35 : D=0 : B=6 : Bob Clear : Bob 1,X,Y,B : Bob Draw : Screen Swap : Wait Vbl : Bob Clear 
  162. End If 
  163.  
  164. _END:
  165. End Proc
  166. Procedure BANG
  167. Bob Clear 
  168. If BULLETS=<0 Then Goto _END
  169. If B=1
  170.    Bob 1,X,Y-6,20 : Bob Draw : Screen Swap : Wait 3
  171.    Bob Clear : Bob 1,X+2,Y-4,21 : Bob Draw : Screen Swap : Wait 3
  172.    Bob Clear : Bob 1,X+2,Y+1,22 : Bob Draw : Screen Swap : Wait 8
  173.    Bob Clear : Bob 1,X-1,Y-3,26 : Bob Draw : Screen Swap : Wait 5 : X=X-1
  174.    Bob Clear : Bob 1,X+2,Y-4,27 : Bob Draw : Screen Swap : Wait 10 : X=X-1
  175.    Bob 2,X+30,Y+6,19
  176.    Channel 2 To Bob 2
  177.    Amal 2,"L: M 900,0,100" : Amal On 
  178.    For I=X To X-50 Step -4 : Bob Clear 
  179.    Bob 1,I,,26 : Gosub _COLLISIONS
  180.       If SX=<10 : SX=10 : Screen Offset 0,SX,SY : Goto SKIP : End If 
  181.       If X=>840 : Goto SKIP : End If 
  182.    SX=SX-4 : Screen Offset 0,SX,SY
  183. SKIP:
  184.    Bob Draw : Screen Swap : Wait Vbl : Next I : X=X-50
  185.  
  186.    Bob Clear : Bob 1,X-1,Y-3,28 : Bob Draw : Screen Swap : Wait 5 : X=X-1
  187.    Bob Clear : Bob 1,X+2,Y+1,22 : Bob Draw : Screen Swap : Wait 5
  188.    Bob Clear : Bob 1,X+2,Y-4,21 : Bob Draw : Screen Swap : Wait 3
  189.    Bob Clear : Bob 1,X,Y-6,20 : Bob Draw : Screen Swap : Wait 10
  190.    Bob Clear : B=1 : Bob 1,X,Y,B : Bob Draw : Screen Swap : Wait Vbl : BULLETS=BULLETS-1 : Goto _END
  191. End If 
  192.  
  193. If B=4
  194.  Bob 1,X-7,Y-7,23 : Bob Draw : Screen Swap : Wait 3
  195.    Bob Clear : Bob 1,X-10,Y-4,24 : Bob Draw : Screen Swap : Wait 3
  196.    Bob Clear : Bob 1,X-12,Y,25 : Bob Draw : Screen Swap : Wait 8
  197.    Bob Clear : Bob 1,X-27,Y-4,29 : Bob Draw : Screen Swap : Wait 5
  198.    Bob Clear : Bob 1,X-27,Y-5,30 : Bob Draw : Screen Swap : Wait 10 : X=X-1
  199.    Bob 2,X-25,Y+2,19
  200.    Channel 2 To Bob 2
  201.    Amal 2,"L: M -900,0,100" : Amal On 
  202.    For I=X To X+50 Step 4 : Bob Clear 
  203.    Bob 1,I,,30 : Gosub _COLLISIONS
  204.       If SX=>715 : SX=715 : Screen Offset 0,SX,SY : Goto SKIP2 : End If 
  205.       If X=<130 : Goto SKIP2 : End If 
  206.    SX=SX+6 : Screen Offset 0,SX,SY
  207. SKIP2:
  208.    Bob Draw : Screen Swap : Wait Vbl : Next I : X=X+80
  209.    Bob Clear : Bob 1,X-27,Y-3,31 : Bob Draw : Screen Swap : Wait 5 : X=X-1
  210.    Bob Clear : Bob 1,X-12,Y,25 : Bob Draw : Screen Swap : Wait 5
  211.    Bob Clear : Bob 1,X-10,Y-4,24 : Bob Draw : Screen Swap : Wait 3
  212.    Bob Clear : Bob 1,X-7,Y-7,23 : Bob Draw : Screen Swap : Wait 10
  213.    Bob Clear : B=4 : Bob 1,X,Y,B : Bob Draw : Screen Swap : Wait Vbl : BULLETS=BULLETS-1 : Goto _END
  214. End If 
  215.  
  216. ' Bullet collisions
  217. ' Bullet hits Saga 1 
  218.  
  219. _COLLISIONS:
  220.  
  221. If Bob Col(2,15 To 15)
  222.    SAGA1=SAGA1+1
  223.       If SAGA1=>3
  224.          Amal Off 10
  225.          Bob Clear : Bob 15,,,52 : Bob Off 2 : Bob Draw : Screen Swap : Wait 4
  226.          Bob Clear : Bob 15,,,53 : Bob Draw : Screen Swap : Wait 4
  227.          Bob Clear : Bob 15,,,54 : Bob Draw : Screen Swap : Wait 4
  228.          Bob Clear : Bob 15,,,53 : Bob Draw : Screen Swap : Wait 4
  229.          Bob Clear : Bob 15,,,52 : Bob Draw : Screen Swap : Wait 4 : Bob Clear 
  230.          Bob Off 15
  231.       End If 
  232.  
  233.          Bob Clear : Bob 15,,,52 : Bob Off 2 : Bob Draw : Screen Swap : Wait 4
  234.          Bob Clear : Bob 15,,,53 : Bob Draw : Screen Swap : Wait 4
  235.          Bob Clear : Bob 15,,,54 : Bob Draw : Screen Swap : Wait 4
  236.          Bob Clear : Bob 15,,,53 : Bob Draw : Screen Swap : Wait 4
  237.          Bob Clear : Bob 15,,,52 : Bob Draw : Screen Swap : Wait 4
  238.          Bob Clear : Bob 15,,,51 : Bob Draw : Screen Swap : Wait Vbl : Bob Clear 
  239.          Amal On 10
  240. End If 
  241.  
  242. If Bob Col(1,20 To 21)
  243.    Bob Clear : Bob Off 2 : Bob Draw : Screen Swap : Wait Vbl : Bob Clear : BULLETS=BULLETS+2
  244. End If 
  245.  
  246. Return 
  247.  
  248. _END:
  249. End Proc
  250.  
  251. Procedure LIMITATIONS
  252. If X=<10 Then Bob Clear : X=10 : Bob 1,X,Y,B : Bob Draw : Screen Swap : Wait Vbl : Bob Clear : Bob Draw : Screen Swap : Wait Vbl 
  253. If X=>975 Then Bob Clear : X=975 : Bob 1,X,Y,B : Bob Draw : Screen Swap : Wait Vbl : Bob Clear : Bob Draw : Screen Swap : Wait Vbl 
  254. If SX=<10 Then SX=10
  255. End Proc
  256. Procedure _SCROLLRIGHT
  257. If SX=>715 Then SX=715 : Goto _END
  258. If X=<130 Then Goto _END
  259.  
  260. SX=SX+1 : Screen Offset 0,SX,SY
  261.  
  262. _END:
  263. End Proc
  264. Procedure _SCROLLLEFT
  265. If SX=<10 Then SX=10 : Goto _END
  266. If X=>840 Then Goto _END
  267.  
  268. SX=SX-1 : Screen Offset 0,SX,SY
  269.  
  270. _END:
  271. End Proc
  272.  
  273. Procedure FALL
  274. If Bob Col(1,4 To 6) Then Goto _END
  275. If Zone(X,Y)=1 or Zone(X,Y)=2 or Zone(X,Y)=3 Then Goto _END
  276. If Y=>197 Then Y=197 : Goto _END
  277.  
  278. Bob Clear 
  279. Y=Y+2 : Bob 1,X,Y,B : Bob Draw : Screen Swap : Wait Vbl : Bob Clear 
  280. Bob Draw : Screen Swap : Wait Vbl 
  281.  
  282. _END:
  283. End Proc
  284. Procedure UPPERS
  285. If Bob Col(1,4 To 6)
  286.    Bob Clear : Y=Y-1 : Bob 1,X,Y,B : Bob Draw : Screen Swap : Wait Vbl : Bob Clear : Bob Draw : Screen Swap : Wait Vbl 
  287. End If 
  288. End Proc
  289.  
  290. Procedure _BOBS
  291. ' Stones 
  292. Bob 4,550,200,32
  293. Bob 5,150,200,32
  294. Bob 6,360,202,33
  295. ' Gun
  296. Bob 10,320,138,39
  297. Bob 11,520,150,40
  298. ' Saga 1 
  299. Bob 15,420,164,50
  300. ' Bird 1 
  301. Bob 20,900,195,41
  302. ' Bird 2 
  303. Bob 21,900,100,41
  304. End Proc
  305. Procedure GUNCHECK
  306. If Bob Col(1,10 To 10)
  307.    Bob Clear : Bob Off 10 : Bob Draw : Screen Swap : Wait Vbl : Bob Clear 
  308.    GUN=1 : BULLETS=BULLETS+6
  309. End If 
  310.  
  311. If Bob Col(1,11 To 11)
  312.    Bob Clear : Bob Off 11 : Bob Draw : Screen Swap : Wait Vbl : Bob Clear 
  313.    BULLETS=BULLETS+6
  314. End If 
  315.  
  316. End Proc
  317.  
  318.  
  319. 'Subroutines:
  320.  
  321. GAMEOVER:
  322. Bob Update On : Amal Off 
  323. Bob 1,X,Y,34 : Wait 4
  324. Bob 1,X-4,Y-1,35 : Wait 4
  325. Bob 1,X-5,Y,36 : Wait 4
  326. Bob 1,X-5,Y,37 : Wait 4
  327. Bob 1,X-5,Y,38 : Wait 6 : Bob Off 1
  328. Screen 1 : A=$111 : Fade 5,,A,A,A,A,$202,A,A,A : Wait 75
  329. End 
  330.  
  331. HOLES:
  332. If Y=197 and X=>265 and X=<275 or Y=197 and X=>475 and X=<485 or Y=197 and X=>810 and X=<820 or Y=197 and X=>872 and X=<908
  333.    For I=Y To Y+43 Step 3
  334.    Wait Vbl : Bob Clear : Bob 1,X,I,B : Bob Draw : Screen Swap : Next I
  335.    Y=Y+42 : Goto GAMEOVER
  336. End If 
  337. Return 
  338.  
  339. _COLLISIONS:
  340. ' Saga 1 
  341.  
  342. If Bob Col(1,15 To 15)
  343.    Goto GAMEOVER
  344. End If 
  345.  
  346. ' Bird 1 + 2 
  347. If Bob Col(1,20 To 21)
  348.    Goto GAMEOVER
  349. End If 
  350. _END:
  351. Return 
  352.  
  353. End 
  354.  
  355. ' By Asa Margetts   1995 Firstrate Effex 
  356. ' ~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~